﻿using System.Globalization;
using System.Text;

namespace Koala.Pro.Common
{
    public class StringUtil
    {
        public static string ToProperCase(string s)
        {
            string result = "";
            if (s.Length > 0)
            {
                if (s.IndexOf(" ") > 0)
                {
                    string[] array = s.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    StringBuilder stringBuilder = new StringBuilder();
                    string[] array2 = array;
                    foreach (string text in array2)
                    {
                        string text2 = text.Substring(0, 1).ToUpper(new CultureInfo("en-US"));
                        text2 += text.Substring(1, text.Length - 1);
                        stringBuilder.Append(text2);
                    }
                    result = string.Join("", stringBuilder);
                }
                else
                {
                    result = s.Substring(0, 1).ToUpper(new CultureInfo("en-US")) + s.Substring(1, s.Length - 1);
                }
            }
            return result;
        }
    }

}
